package com.andnnl.jetty;


import com.andnnl.config.ConfigFileHelper;
import org.eclipse.jetty.server.Server;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Created by chenss on 2023/8/24.
 */
public class StatusJetty {
    private static Logger log = LoggerFactory.getLogger(StatusJetty.class);

    public static void init() {
        try {
            ConfigFileHelper c = new ConfigFileHelper("config");
            int port = c.getInt("jetty.port", 8080);
            if (port == 0) return;
            Server server = new Server(port);
            server.setHandler(new MoHttpServer());
            server.start();
            log.info("jetty server listen port " + port);
            server.join();
        } catch (Exception e) {
            log.error(e.getMessage(),e);
        }
    }

    public static void main(String[] args) {
        init();
    }
}
